<?php
    /**
    * Email : mr.linhtx88@gmail.com   
    * Phone : +84919.021.508
    * 
    * History       :
    *   Date        : 16-Apr-2012
    *   Modified by : mr.linhtx88@gmail.com        
    *   Purpose     : create class bllPoem, function getLatest contect % link 
    */

    include_once("./Library/DataProvider/Story/dalPoem.php");  
    include_once("./Library/Utility/utility.php");     
    
    class bllPoem{        

        public function getTopPoem_1($forumid){  
            $forumid = utility::CheckInput($forumid);  
            
            $query = "select p.pagetext, t.title, p.threadid
            from post p, thread t
            where p.threadid=t.threadid
            and t.forumid = ".$forumid."
            order by p.threadid desc
            limit 1"; 
            // return
            return dalPoem::getTopPoem_1($query); 
        }         

        public function getTopPoem_2($forumid){  
            $forumid = utility::CheckInput($forumid);  
            
            $query = "select p.pagetext, t.title, p.threadid
            from post p, thread t
            where p.threadid=t.threadid
            and t.forumid = ".$forumid."
            order by p.threadid desc
            limit 2"; 
            // return
            return dalPoem::getTopPoem_2($query); 
        }    

        public function getTopPoem_3($forumid){  
            $forumid = utility::CheckInput($forumid);  
            
            $query = "select p.pagetext, t.title, p.threadid
            from post p, thread t
            where p.threadid=t.threadid
            and t.forumid = ".$forumid."
            order by p.threadid desc
            limit 3"; 
            // return
            return dalPoem::getTopPoem_3($query); 
        }   
    }   
?>
